from django.contrib import admin

# Register your models here.
from view_study.models import *

admin.site.register(Author)
admin.site.register(Tag)


# admin.site.register(Category)


# @admin.register(Student)
# class Student_Ad(admin.ModelAdmin):
#     list_display = ["name", "age"]
#     search_fields = ["name"]
#     fieldsets = (
#         ("姓名", {"fields": ["name"]}),
#         ("年龄", {"fields": ["age"]})
#     )


@admin.register(Post)
class Post_Ad(admin.ModelAdmin):
    list_display = ["name", "myauthor", "mytag", "mycategory"]


class Postin(admin.StackedInline):
    model = Post
    extra = 2


@admin.register(Category)
class CategoryAd(admin.ModelAdmin):
    list_display = ["category_name"]
    inlines = [Postin]
